package com.bwie.controller;
import com.bwie.domain.Activity;
import com.bwie.service.ActivityService;
import com.bwie.service.impl.ActivityServiceImpl;
import com.bwie.utils.R;
import org.springframework.web.bind.annotation.*;

import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.Resource;

/**
* 秒杀活动表(t_activity)表控制层
*
* @author xxxxx
*/
@RestController
@RequestMapping("/goods/activity")
public class ActivityController {
/**
* 服务对象
*/
    @Resource
    private ActivityService activityService;

    @GetMapping("/getActivityList")
    public R getActivityList(){
        return activityService.getActivityList();
    }

    @PostMapping("/getGoods/{id}")
    public R getGoods(@PathVariable("id") Long id){
        return activityService.getGoods(id);
    }

    @PostMapping("/execute/{activityId}")
    public R execute(@PathVariable("activityId") Long activityId,
                     @RequestParam String userId){
        return activityService.execute(activityId,userId);
    }
}
